package com.learn.project2.controller.wx.goods;


import com.learn.project2.model.bo.wx.goods.GoodsListBO2;
import com.learn.project2.model.vo.wx.goods.GoodsCategoryVO2;
import com.learn.project2.model.vo.wx.goods.GoodsDetailVO2;
import com.learn.project2.model.vo.wx.goods.GoodsListVO2;
import com.learn.project2.model.vo.wx.goods.GoodsRelatedVO2;
import com.learn.project2.service.wx.goods.GoodsService2;
import com.learn.project2.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * \* Author: Valley
 * \* Date: 2022/1/8
 * \* Time: 20:54
 * \* Description:
 */
@RestController
@RequestMapping("wx/goods")
public class GoodsController2 {

    @Autowired
    GoodsService2 goodsService2;

    /** 
     * @description:  分类-商品总数
     * @param: [] 
     * @return: com.learn.project2.utils.Result 
     * @author 王力
     * @date: 2022-01-08 21:09:14
     */
    @RequestMapping("count")
    public Result count(){
        Integer count = goodsService2.goodsCount();
        return Result.ok(count);
    }

    /**
     * @description: 商品-分类-category
     * @param: [id]
     * @return: com.learn.project2.utils.Result
     * @author 王力
     * @date: 2022-01-09 15:00:11
     */
    @RequestMapping("category")
    public Result category(Integer id){
        GoodsCategoryVO2 categoryVO2 = goodsService2.goodsCategory(id);
        return Result.ok(categoryVO2);
    }

    /**
     * @description: 商品种类-list
     * @param: [listBO2]
     * @return: com.learn.project2.utils.Result
     * @author 王力
     * @date: 2022-01-09 15:27:49
     */
    @RequestMapping("list")
    public Result list(GoodsListBO2 listBO2){
        GoodsListVO2 listVO2 = goodsService2.goodsList(listBO2);
        return Result.ok(listVO2);
    }
    
    /** 
     * @description: 商品详情-detail
     * @param: [] 
     * @return: com.learn.project2.utils.Result 
     * @author 王力
     * @date: 2022-01-09 15:36:52
     */
    @RequestMapping("detail")
    public Result detail(Integer id){
        GoodsDetailVO2 detailVO2 = goodsService2.goodsDetail(id);
        return Result.ok(detailVO2);
    }

    /**
     * @description: 商品详情-related
     * @param: [id]
     * @return: com.learn.project2.utils.Result
     * @author 王力
     * @date: 2022-01-09 22:16:34
     */
    @RequestMapping("related")
    public Result related(Integer id){
        GoodsRelatedVO2 relatedVO2 = goodsService2.goodsRelated(id);
        return Result.ok(relatedVO2);
    }
}
